Skip to content

ci(testnet): reproduce the contract state divergence with a dice contract - #93

Merged
EnzinoBB merged 1 commit into
masterfrom
ci/contract-dice
Oct 24, 2026
Merged

EnzinoBB merged 1 commit into
masterfrom
ci/contract-dice

Conversation

@EnzinoBB

Copy link
Copy Markdown
Collaborator

Step 0 of the contract state sync plan (docs/specs/2026-10-24-contract-state-sync-design.md on docs/contract-state-sync).

Dice reads its own balance and pays 10 CS when it holds at least 20, as the mainnet dice contracts do. contracts.py --dice (run.sh CONTRACT_DICE=1) deploys and funds it, then two players play it three times in turn before the restart test, each play followed by a 10 CS top-up. Its state is compared on every node.

Scenario contracts-dice-join (manual): a node syncs from block 0 through the plays. With today's code it fails as expected (run 40098904794):

  • balances: STATE DIGEST #1000 is 42668332… on the joining node n8 and 72126ED7… on all the others;
  • contract: FAIL: nodes disagree on the Dice state (n8 25247865…, the others 4b0eb779…);
  • n8's log has three state of J3w3e… declared by the block is not available while reading the blockchain lines, one per play.

The scenario stays manual until the fix makes it pass; then the flag goes.

🤖 Generated with Claude Code

…ract

Dice reads its own balance and pays 10 CS when it holds at least 20: a
node re-executing it while it syncs sees the balance after the same
block's payout, throws, keeps a stale state and charges a later payout's
fee to the previous player. contracts.py --dice (run.sh CONTRACT_DICE=1)
deploys it, funds it, and has two players play it three times in turn
before the restart test; its state is compared on every node.
Scenario contracts-dice-join (manual): a node syncs from block 0 through
the plays. It is expected to fail until contract states are fetched
instead of re-executed (step 0 of the contract state sync plan).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EnzinoBB
EnzinoBB merged commit 1539804 into master Oct 24, 2026
50 of 51 checks passed
EnzinoBB added a commit that referenced this pull request Oct 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnzinoBB added a commit that referenced this pull request Oct 25, 2026
…ficial joiner diverges on the Dice state, the behaviour #93-#96 fixed)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant